Downstream Message Push using JMS and SOAP on the TomEE Server

Overview

DMP adds ability to push messages downstream on completion of an activity before data is committed to Database. The functionality is enabled using the configuration provided in business rule.

Scenario

We are using the Prototype company and its default configuration for setting the DownstreamMessagePush feature for the V12.2.0.0 version on the TomEE server.

Pre-requisite

  1. Verify which version of TomEE server is installed.

  2. The PAS.properties should be setup to define the environment to be used to send messages.

  3. Verify if the Rules Palette version is 12.2.0.x.

  4. Verify if Acoutboundevent table is created in Admin Console database. How to Setup Admin Console on TomEE.

Step 1: Set Up

Modify the PAS.properties file

In the PAS.properties file add the following property:

#-----------------------------------------------------------------------
# Development mode is pointed to Development environment
# Production mode is pointed to Production environment
# Test mode is pointed to Test environment
#-----------------------------------------------------------------------
downstream.service.event.mode=Development
#-----------------------------------------------------------------------
# Required for viewing JMX events published on Admin Console. For DMP, outboundEventPush entity needs to be added
#-----------------------------------------------------------------------
jmx.notification.entities=cycle,login,activity,activityprofiling,outboundEventPush

Step 2: Configure TomEE

Configuring Connection Factory and Message Queue in the tomee.xml file. The following example describes the configuration of DownstreamMessagePush if the server is running locally.

TomEE 9.x (Java 17)

<Resource id="JMSResourceAdapter" type="ActiveMQResourceAdapter">
BrokerXmlConfig = broker:(tcp://hostname:port)
ServerUrl = tcp://hostname:port
DataSource = ADMINSERVERDS
</Resource>
<Resource id="DownstreamMessagePushConnectionFactory" type="jakarta.jms.ConnectionFactory">
resourceAdapter = JMSResourceAdapter
</Resource>
<Container id="JmsMdbContainer" ctype="MESSAGE">
ResourceAdapter = JMSResourceAdapter
</Container>
<Resource id="DownstreamMessagePushQueue" type="jakarta.jms.Queue"/>

Step 3: Create Transaction

To create a Transaction for the DownstreamMessagePush in Rules Palette:

  1. Go to Main Explorer > Companies > Prototype > Subsidiary Companies.

  2. In the Prototype Individual Child Company > Product > Individual Prototype Product > Plans > Functional Prototype Product.

  3. Select Transaction and right-click Transaction and click New Transaction.

  4. In the New Transaction text box, enter the name DownstreamMessagePush and click Next.

  5. Select the Transaction Type as Policy-Financial and click Next.

  6. Add the following configuration and check in the changes.

    <Transaction>
    <EffectiveDate STATUS="Enabled" TYPE="SYSTEM"/>
    <Fields>
    <Field>
    <Name>TextArea1</Name>
    <Display>Text Area 1 Field</Display>
    <DataType>TextArea</DataType>
    </Field>
    <Field>
    <Name>GraceMoney</Name>
    <Display>Grace Money Received</Display>
    <DataType>Money</DataType>
    <Currency>EUR,JPY,THB,TWD,USD</Currency>
    <DefaultValue>0</DefaultValue>
    </Field>
    <Field>
    <Name>SomeDate</Name>
    <Display>Date</Display>
    <DataType>Date</DataType>
    </Field>
    <Field>
    <Name>field2</Name>
    <Display>Grace Money Comment</Display>
    <DataType>Text</DataType>
    </Field>
    <Field>
    <Name>Test</Name>
    <Display>GraceMoney Comment21</Display>
    <DataType>Text</DataType>
    </Field>
    <Field>
    <Name>PolicyCurrencySupportTest1</Name>
    <Display>Bug Retest Currency21</Display>
    <DataType>Money</DataType>
    <DefaultValue>0</DefaultValue>
    </Field>
    <Field>
    <Name>PaymentMode</Name>
    <Display>PaymentMode</Display>
    <DataType>Decimal</DataType>
    <DefaultValue>1</DefaultValue>
    </Field>
    </Fields>
    <Math>
    <MathVariables>
    <MathVariable VARIABLENAME="True" TYPE="VALUE" DATATYPE="TEXT">01</MathVariable>
    <MathVariable VARIABLENAME="False" TYPE="VALUE" DATATYPE="TEXT">00</MathVariable>
    <MathVariable VARIABLENAME="ActivityEffectiveDate" TYPE="DATE" DATATYPE="FORMATDATE" OPERATION="CONVERT" TOFORMAT="YYYY-'W'ww-u">Activity:EffectiveDate</MathVariable>
    <MathVariable VARIABLENAME="EventDateTime" TYPE="DATE" DATATYPE="FORMATDATE" OPERATION="GENERATE" TOFORMAT="YYYY-'W'ww-u"/>
    <MathVariable VARIABLENAME="RequiredMV" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
    <MathVariable VARIABLENAME="ActivityEffDate" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
    <MathVariable VARIABLENAME="PaidToDate" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
    <MathVariable VARIABLENAME="BigTextMV1" TYPE="FIELD" DATATYPE="BIGTEXT">Activity:TextArea1</MathVariable>
    <MathVariable VARIABLENAME="payerName" TYPE="VALUE" DATATYPE="TEXT">Chris Snow</MathVariable>
    <MathVariable VARIABLENAME="isReBill" TYPE="VALUE" DATATYPE="BOOLEAN">false</MathVariable>
    </MathVariables>
    </Math>
    </Transaction>
  7. Go to Admin Explorer tab > Security > Application Security > Security folder.

  8. Select Prototype > Company Security > Transaction Security folder > Prototype Individual Child Company and then right-click to select Grant Access to All Transaction to provide the authorization for the Transaction.

  9. In the Functional Prototype Product > Plan Rule, select EligibleTransactionByPolicy Status add the newly created Transaction DownstreamMessagePushDefinition.

Step 4: Configure PushNotifications

To configure the PushNotification, perform the following:

  1. Go to the Rules Palette > Global Explorer > Business Rules.

  2. Select Attach Business Rule and right-click Attached Rule and select the New Global Rule for Category Attached.

  3. The New Global Rule window appears, enter the new business Rule name as PushNotifications and click Next.

  4. Select Transaction and click Next (select the transaction where we want to override this new business rule) and click Next.

  5. Click Finish, then PushNotifications Business rule is created.

  6. Add the below configuration example and check the rule.

  7. Evenetname used in the following configuration need to be created using Downstream Message Push for REST.

    Example: <PushNotification EVENTNAME="Billing">

    <PushNotifications>
    <Templates>
    <Template ID="Header">
    <JSTLMessage>
    <Parameters>
    <Parameter DATATYPE="FORMATDATE" NAME="ActivityEffectiveDate">ActivityEffectiveDate</Parameter>
    <Parameter DATATYPE="Text" NAME="ActivityGUID">Activity:ActivityGUID</Parameter>
    </Parameters>
    <ActivityGUID>[ActivityGUID]</ActivityGUID>
    <ActivityEffectiveDate>[ActivityEffectiveDate]</ActivityEffectiveDate>
    <EventDateTime>[EVENTDATETIME]</EventDateTime>
    </JSTLMessage>
    </Template>
    <Template ID="Header1">
    <JSTLMessage>
    <Parameters>
    <Parameter DATATYPE="Date" NAME="EFFdate">Activity:EffectiveDate</Parameter>
    </Parameters>
    <EffectiveDate>[EFFdate]</EffectiveDate>
    </JSTLMessage>
    </Template>
    </Templates>
    <!-- Sample message template -->
    <PushNotification EVENTNAME="Billing">
    <Message ID="BillingMsg1">
    <Tests>
    <Test>1=1</Test>
    <Test>1=1</Test>
    </Tests>
    <AsEventMessage xmlns="http://xmlns.alamere.com/PAS/AsEventMessage">
    <JSTLTemplate>Header</JSTLTemplate>
    <JSTLTemplate>Header1</JSTLTemplate>
    <JSTLMessage>
    <Parameters>
    <Parameter DATATYPE="TEXT" NAME="payerName">payerName</Parameter>
    <Parameter DATATYPE="BOOLEAN" NAME="isReBill">isReBill</Parameter>
    <Parameter DATATYPE="BIGTEXT" NAME="BigTextMV1">BigTextMV1</Parameter>
    <Parameter DATATYPE="Date" NAME="RequiredMV">RequiredMV</Parameter>
    </Parameters>
    <Billing>
    <Reversal>[REVERSAL]</Reversal>
    <BigTextMV1>[BigTextMV1]</BigTextMV1>
    <payerName>[payerName]</payerName>
    <isReBill>[isReBill]</isReBill>
    </Billing>
    <Premium>
    <Area>[BigTextMV1]</Area>
    <Date>[RequiredMV]</Date>
    </Premium>
    </JSTLMessage>
    </AsEventMessage>
    </Message>
    </PushNotification>
    <OnPushFailure>
    <RollbackTransaction>Yes</RollbackTransaction>
    <CreateBusinessError>Yes</CreateBusinessError>
    </OnPushFailure>
    </PushNotifications>
  8. Outbound configuiration should be as:

{"providerUrl":"http://xxx.xx.xxx.xx:xxxx",
"connectionFactory":"openejb:Resource/DownstreamMessagePushConnectionFactory",
"destinationName":"openejb:Resource/DownstreamMessagePushQueue",
"deliveryMode":"DeliveryMode.NONPERSISTENT",
"acknowledgementMode":"AUTO_ACKNOWLEDGE",
"timeToLive":"5000000",
"priorityLevel":1} ------ out bound configuration

Step 5: Process Activity in OIPA

  1. Login to OIPA application, go to Policy Activity Screen add the DownstreamMessagePushDefinition transaction configured above from the add activity option.

  2. Enter the values in the fields and save the activity.

  3. Process the activity.

  4. The activity should be processed successfully.

Step Result

Admin Console DB is used to set up admin console for tracking the messages. To view the messages launch SQL Database and in the Admin Console Database, query for AcOutboundEvent table and verify the message sent.